<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        ul{
            overflow: hidden;
        }
        .tab li {
            float: left;
            width: 100px;
            height: 45px;
            line-height: 45px;
            text-align: center;
            cursor: pointer;
            list-style: none;
            border-right: 1px solid #ccc;
        }

        .tab .current {
            background-color: orange;
        }
        .tab div{
            width: 300px;
            height: 300px;
            line-height: 300px;
            text-align: center;
            background-color: pink;
            font-size: 30px;
            display: block;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="tab">
            <ul>
                <!-- <li v-for="(item,index) in tabs" :key="item.id" :class="{current:index === currtindex}">{{item.title}}</li> -->
                <li v-for="(item,index) in tabs" :key="item.id" :class="index === currtindex? 'current':''" @click="changeTab(index)">{{item.title}}</li>
            </ul>
            <div>{{tabs[currtindex].content}}</div>
        </div>
    </div>


    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
    <script>
        const vm = new Vue({
            el: "#app",
            data: {
                currtindex: 0,
                tabs: [
                    {
                        id: "1",
                        title: "title1",
                        content: "content1",
                    },
                    {
                        id: "2",
                        title: "title2",
                        content: "content2",
                    },
                    {
                        id: "3",
                        title: "title3",
                        content: "content3",
                    },
                ],
            
            },
            methods:{
                changeTab(index){
                    this.currtindex = index;
                }
            }
        });
    </script>
    
</body>

</html>